package com.example.customeview;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.animation.AnimationUtils;

import java.util.ArrayList;
import java.util.Collections;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.d(TAG, "onCreate: 当前屏幕的宽度时"+getWidth());
        Log.d(TAG, "onCreate: 当前屏幕的高度时"+getHeight());
    }


    public int getWidth() {
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        int xdpi = displayMetrics.widthPixels;
        return xdpi;
    }
    public int getHeight(){
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        int heightPixels = displayMetrics.heightPixels;
        return heightPixels;
    }


}